<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ include file="/WEB-INF/views/taglibs.jsp"%>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<script type="text/javascript" charset="utf-8" src="${ctx}/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="${ctx}/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="${ctx}/ueditor/lang/zh-cn/zh-cn.js"></script>
</head>
<body id="body">
	<form id="form" action="insert" enctype="multipart/form-data"
		method="post">
		<div class="dialogPage">
			<div class="om-panel-header">新增</div>
			<div class="editDiv">
				<table class="editTable">
					<tr>
						<td><span class="required">*</span>标题：</td>
						<td><input type="text" id="title" name="title"
							class="easyui-validatebox"  data-options="required:true" value=""></td>
						<td><span class="required">*</span>类型：</td>
						<td><input id="type" name="type" type="combo" /></td>
					</tr>
					<tr>
						<td><span class="required">*</span>封面：</td>
						<td colspan="3"><input type="text" class="upload  easyui-validatebox" placeholder="上传图片格式：gif,jpg,jpeg,png"
							name="cover"
							filter='{"extensions":"gif,jpg,jpeg,png","title":"cover"}'>
						</td>
						<td><span class="required">*</span>语言：</td>
						<td><input id="language" name="language" type="combo" /></td>
					</tr>
					<%-- <tr>
						<td>视频地址：</td>
						<td colspan="5"><input type="text" class="upload"
							filter='{"extensions":"mp4","title":"contentFile"}'
							name="contentFile" id="contentFile" cols="128" rows="1"
							maxlength="200" /></td>
					</tr> --%>
					<tr>
						<td><span class="required">*</span>描述：</td>
						<td colspan="5"><textarea name="remark" id="remark"
								cols="128" rows="3" maxlength="200"></textarea></td>
					</tr>

				</table>
				<input id="status" type="hidden" name="status" />
				<!-- 加载编辑器的容器 -->
				<script id="content" name="content" type="text/plain"
					style="width: 950px; height: 200px; margin-left: 20px;"></script>
				<div class="editBtn" style="margin-top: 20px;">
					<button id="btnPublish" type="button" class="button" status="2">发&nbsp;&nbsp;布</button>
					<button type="button" onclick="javascript:art.dialog.close();"
						class="button">&nbsp;关闭&nbsp;</button>
				</div>
			</div>
		</div>
	</form>
</body>
<script type="text/javascript" src="${js}/plupload/ossPlupload.js?version=${version}"></script>
<script type="text/javascript">
	/**
	 *初始化文件上传控件
	 */

	$('.upload').uploader({
		url : ctx + "/signature/oos",
		dir : '8wine/news/'
	});

	var ue;
	$(function() {

		var languageData = JSON.parse('${languageCombo}');

		var language = languageData[0].value;

		var newsTypeData = JSON.parse('${typeCombo}');

		var newsType = newsTypeData[0].value;

		$('#language').combobox({
			data : languageData,
			editable : false,
			value : language,
			panelHeight : 'auto'
		});

		$('#type').combobox({
			data : newsTypeData,
			editable : false,
			value : newsType,
			panelHeight : 'auto'
		});

		//初始化文本编辑器
		ue = UE.getEditor('content');

		//初始化内容
		ue.ready(function() {
			//this是当前创建的编辑器实例
			this.setContent('')
		});

		$('#btnSubmit,#btnPublish').click(function() {
			if (!$("#form").form('validate')) {
				return false;
			}
			var msgContent = ue.getContent();
			if (msgContent.length == 0) {
				alert("请输入详情");
				return false;
			}

			//获取状态
			$("#status").val($(this).attr("status"));

			$('#form').submit();

			$('#btnSubmit').attr({
				"disabled" : "disabled"
			});

			$('#body').html("正在提交，请稍后。。");

		});

	});
</script>
</html>